<?php
    require('./Utils.php');

    $post = getJsonParamter();

    $username = $post['username'];
    $amount = $post['amount'];

    $conn = getConnection();
    $sql = "UPDATE user SET amount = amount + ? WHERE username = ?";

    $result = execute($conn, $sql, $amount, $username);

    if($result){
        getJson(200,'充值成功', null);
    }else{
        getJson(500, '充值失败', null);
    }
?>